package com.design_pattern.proxy;

import java.lang.reflect.Method;

public class DIY2Interceptor implements MyInterceptor {

    @Override
    public Boolean before(Object proxy, Object target, Method method, Object[] args) {
        if (target instanceof Inter && "小张".equals(((Inter) target).getName())) {
            return false;
        } else {
            return true;
        }
    }

    @Override
    public void around(Object proxy, Object target, Method method, Object[] args) {
        System.out.println("DIY2执行中转");
    }

    @Override
    public void after(Object proxy, Object target, Method method, Object[] args) {
        System.out.println("DIY2执行完成");
    }
}
